#include "uibaseimpl.h"
#include "uimessageloopimpl.h"
#include "uiwindowimpl.h"
#include "uicontrolimpl.h"

CUiBaseImpl::CUiBaseImpl(void)
{

}
CUiBaseImpl::~CUiBaseImpl(void)
{
	logi("CUiBaseImpl::~CUiBaseImpl");
}
std_method_impl CUiBaseImpl::Init(int Argc, basic_tchar* Argv[], IBase* pRot, IBase* pBase)
{
	rc_assert(pRot != NULL, E_FAIL)
	return pRot->QueryInterface(IID_IComRotMessage, (void**)&m_pRot);
}
std_method_impl CUiBaseImpl::Uninit()
{
	HRESULT		hr = S_OK;

	return hr;
}

std_method_impl CUiBaseImpl::Start(_pinstance hInstance, UINT uType)
{
	HRESULT		hr = S_OK;

	return S_OK;
}
std_method_impl CUiBaseImpl::Stop(UINT uExitCode)
{
	HRESULT		hr = S_OK;

	return hr;
}
std_method_impl CUiBaseImpl::CreateControl(UIType type, IBase **pControl)
{
	HRESULT		hr = S_OK;

    
	if (IS_UI_MESSAGELOOP(type)) {

		CUiMessageloopImpl*	pObject = NULL;
		pObject = ALLOC_NEW CUiMessageloopImpl;
		rc_assert(pObject != NULL, E_FAIL)
		return pObject->QueryInterface(IID_IUIMessageLoop, (void**)pControl);

	}

#if (TARGET_OS == OS_WINDOWS)
    else if (IS_UI_WINDOWS(type)) {

		CUiWindowsImpl*	pObject = NULL;
		pObject = ALLOC_NEW CUiWindowsImpl;
		rc_assert(pObject != NULL, E_FAIL)
		return pObject->QueryInterface(IID_IUIWindow, (void**)pControl);

	} else if (IS_UI_BUTTON(type)) {

	}
  
#endif
    
    
	return hr;
}
